<template>
	<view class="cttit">
		<text>祭祖订单</text>
		<view class=""></view>
	</view>
	<view class="listbg">
		<view class="listitem" v-for="(item,index) in list" :key="index">
			<view class="titles">
				订单编号：{{item.no}}
			</view>
			
			<view class="rightitem" v-for="(item2,index2) in item.orderGoodsList">
				<image  :src="item2.goodsUrl?item2.goodsUrl.split(',')[0]:''" mode="aspectFill"></image>
				<view class="ritem">
					<view class="psd">x{{item2.goodsNum}}</view>
					<view class="">
						<text class="aa">{{item2.goodsName}}</text>
						<view class="gys">已选：{{item2.spName}}</view>
					</view>
					<view class="ritemb">
						<text>￥<text>{{item2.goodsPrice}}</text> </text>

					</view>
				</view>
			</view>

			
			<view class="paybn" v-if="item.payTime">支付时间：<text>{{item.payTime}}</text> </view>
			<view class="paybn">支付方式：<text>{{item.payType==0?'微信':'支付宝'}}支付</text> </view>
			
			<view class="ct">
				<image :src="item.img?item.img.split(',')[0]:''" mode="aspectFill"></image>
				<view class="">
					<text>{{item.ancestralName}}</text>
					<text>{{item.tabletName}}</text>
				</view>
			</view>
		</view>
	</view>
		<up-loadmore  lineColor="#ccc" line	 :status="status" />
</template>

<script setup>
	import {
		ref,
		onMounted
	} from 'vue';
	import { orderList } from "@/api/ancestra.js"
	import {
		onLoad,
		onReachBottom
	} from '@dcloudio/uni-app';

	onReachBottom(() => {
		page.value++
		getList()
	})
	onLoad((e) => {	
		getList()	
	})

	let status=ref('')
	let list = ref([])
	let page=ref(1)
	
	function getList() {
		
		let data = {
			pageSize: 10,
			pageNum: page.value,
		}
		status.value='loading'
		
		orderList(data).then(res => {
			status.value='nomore'
			if (page.value == 1) {
				list.value = res.rows
			} else {
				if (res.rows.length == 0) {
					page.value--
				} else {
					list.value = [...list.value, ...res.rows]
				}
			}
		})

	}


</script>


<style lang="scss" scoped>
	.rightitem {
		display: flex;
		align-items: center;
		margin-left: 24rpx;
		margin-top: 24rpx;
		margin-bottom: 24rpx;
	
		&>image {
			width: 140rpx;
			height: 140rpx;
			border-radius: 16rpx;
		}
	
		.ritem {
			display: flex;
			height: 140rpx;
			flex-direction: column;
			justify-content: space-between;
			flex: 1;
			margin-left: 16rpx;
			position: relative;
			.psd{
				position: absolute;
				right: 24rpx;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #111111;
			}
	
			.gys {
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #999999;
				// line-height: 48rpx;
			}
	
			.aa {
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 26rpx;
				color: #111111;
				width: 420rpx;
				display: block;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				/* 定义显示的最大行数 */
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}
	
			.ritemb {
				display: flex;
				align-items: center;
				justify-content: space-between;
	
	
				.rl {
					width: 120rpx;
					height: 44rpx;
					background: #C7A46F;
					border-radius: 22rpx 22rpx 22rpx 22rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFFFFF;
				}
	
				text {
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #A9070C;
	
					text {
	
						font-size: 28rpx;
	
					}
				}
			}
		}
	}
	
	
	.listbg{
		margin-left: 24rpx;
		overflow: hidden;
	    .listitem{
			margin-top: 24rpx;
			width: 702rpx;
			height: auto;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			.ct{
				display: flex;
				align-items: center;
				width: 654rpx;
				margin-left: 24rpx;
				border-top: 1rpx solid #DDDDDD;
				margin-top: 24rpx;
				height: 140rpx;
				&>image{
					width: 94rpx;
					height: 94rpx;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					margin-right: 10rpx;
				}
				view{
					display: flex;
					flex-direction: column;
					text{
						font-family: PingFang-SC, PingFang-SC;
						font-weight: 500;
						font-size: 22rpx;
						color: #111111;
						margin-bottom: 10rpx;
					}
				}
			}
			// <view class="ct">
			// 	<image src="" mode=""></image>
			// 	<view class="">
			// 		<text>某某祠堂</text>
			// 		<text>某某牌位</text>
			// 	</view>
			// </view>
			
			.paybn{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 22rpx;
				color: #999999;
				margin-left: 24rpx;
				margin-top: 10rpx;
				text{
					font-family: PingFang-SC, PingFang-SC;
					font-weight: 500;
					font-size: 22rpx;
					color: #111111;
				}
			}

			
			.titles{
				height: 82rpx;
				width: 654rpx;
				margin-left: 24rpx;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #111111;
				line-height: 82rpx;
				border-bottom: 1rpx solid #DDDDDD;

			}
		}	
	}
	.cttit {
		margin-top: 36rpx;
		margin-left: 24rpx;
		position: relative;
		display: flex;
		flex-direction: column;
	
		&>text {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #111111;
			line-height: 24rpx;
			position: relative;
			z-index: 10;
		}
	
		view {
			width: 130rpx;
			height: 16rpx;
			border-radius: 20rpx;
			background: #C7A46F;
			position: absolute;
			bottom: -6rpx;
		}
	}
</style>